<?php
/* OpenBIBLIO -- A library administration web interface
 * Copyright (C) 2002-2005 Fr&eacute;d&eacute;ric Descamps
 * Copyright (C) 2011-     Laurent Luyssen   <big.lol13@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 $sw    = $_POST['sw'];
 $genre = $_POST['genre'];

                        if($sw==1)
                        {                       
                          $requete = "select * from genres where genre ='$genre'";
                          $resultat = biblio_db_query($requete);
                          $trouve=biblio_db_num_rows($resultat);
                          if ($trouve > 0)
                          {
                           echo "<CENTER><BR>";
			   echo _("Le genre <b>$genre</b> est d&eacute;j&agrave; existant dans la base de donn&eacute;es, recommencez!");
			   echo "<BR><BR>";
                           echo "<A HREF=\"admin.php?action=add&type=genre\">";
			   echo _("retour");
			   echo "</A></CENTER>";
                          }
                          else 
                          {
                           if (add_genre($genre)) {
                           echo "<CENTER><BR><b>$genre</b> ";
						   echo _("est ajout&eacute; &agrave; la base de donn&eacute;es.");
						   echo "<br></center>";
                           }
                          }
                         
                        }
                        else
                        {
                          ?>
                                <CENTER><H3>
				<?php echo _("Ajouter un genre"); ?>
				</H3>
                                <FORM action=admin.php METHOD=POST>
                                <TABLE BORDER=0>
                                <TR>
                                <TD>
				<?php echo _("Genre"); ?>
				:</TD><TD><INPUT TYPE="text" NAME="genre" size=20></TD>                                
                                </TABLE><BR>
                                <INPUT TYPE="hidden" NAME="user" value="<?php echo $user; ?>">
                                <INPUT TYPE="hidden" NAME="action" value="<?php echo $action; ?>">
                                <INPUT TYPE="hidden" NAME="type" value="<?php echo $type; ?>">
                                <INPUT TYPE="hidden" NAME="sw" value="1">
                                <input type="Submit" value="<?php echo _("Enregistrer"); ?>">
                                </FORM>
                                </CENTER>
                                <?php
                        }
?>              
<br><br>
<div>
<span id=left-text>
<A HREF="admin.php?menu=1">
<?php echo _("retour menu administration"); ?>
</A><BR>
<A HREF="index.php">
<?php echo _("retour menu principal"); ?>
</A></span>
</div>
<br>
